﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using SocialPlatformSDK.Services.Util;
using System.Runtime.Serialization;
using SocialPlatformSDK.Util;

namespace SocialPlatformSDK.Model
{
    /// <summary>
    /// Access Token 和 Request Token 的基类.
    /// </summary>
    public abstract class Token
    {
        /// <summary>
        /// 构造函数.
        /// </summary>
        /// <param name="content">回调的字符串.</param>
        //internal Token(string content)
        //{
        //    var result = OAuthHelper.GetQueryParameters(content);

        //    // 通过content, 初始化 Key 和 Secret
        //    this.TokenKey = result["oauth_token"];
        //    this.TokenSecret = result["oauth_token_secret"];
        //}

        /// <summary>
        /// 构造函数，用于反序列化.
        /// </summary>
        public Token()
        { }



        public virtual void LoadToken(string content)
        {
        }
    }

    /// <summary>
    /// Request Toekn 类，用于表示服务器所返回的 Request Token 对象.
    /// </summary>
    public class CodeToken : Token
    {

        /// <summary>
        ///  用来换取accesstoken的授权码，有效期为10分钟
        /// </summary>
        public string Code { get; set; }
     
    }

    /// <summary>
    /// Access Toekn 类，用于表示服务器所返回的 Access Token 对象.
    /// </summary>
    public class AccessToken : Token
    {

        /// <summary>
        /// 获取或设置 Toekn 的 accesssToken.
        /// </summary>
        public virtual string AccesssToken { get; set; }

        /// <summary>
        /// 获取或设置 Toekn 的 refleshToken.
        /// </summary>
        public virtual string RefleshToken { get; set; }

        /// <summary>
        /// 获取或设置 Toekn 的 expriesIn.
        /// </summary>
        public virtual string ExpriesIn { get; set; }

       
       
    }
}
